<include file="Public:basehead"/>
<div class="content">
	<div class="cLineB"><h4>编辑群发内容</h4></div>
         
          <form method="post"  enctype="application/x-www-form-urlencoded">
          <input type="hidden" name="id" value="{cms>$msg.id}" />
          <div class="msgWrap form">
            <table class="userinfoArea" border="0" cellSpacing="0" cellPadding="0" width="100%">
            	<tr>
            		<th>发送对象：</th>
            		<td>
            			<label>二维码分类</label>
            			<input class="px" type="text" readonly="readonly" value="{cms>$qr}">
            			&nbsp;&nbsp;&nbsp;
            			<label>城市</label>
            			<input class="px" type="text" readonly="readonly" value="{cms>$city}">
            		</td>
            	</tr>
            	<tr>
            	<th valign="top">发送内容：</th>
            	<td>
            	<select class="px"  id="response" name="response" style="width:180px;height:30px;">
            	
            	</select>
            	<button id="btn_material" type="button" class="btnGreen" onclick="getMaterial();">获取素材</button>&nbsp;&nbsp;
            	<a href="{cms>:U('Messager/intro')}" target="_blank" >如何选择?</a>
            	</td>	
            	</tr>
            	
            	<tr>
                  <th></th>
                  	<td>
                  		<input type="submit" value="发送" name="sbmt" class="btnGreen left">　
                  		<a href="{cms>:U('Messager/index')}"  class="btnGray vm">取消</a>
                  	</td>
                </tr>
                
            </table>
            
          </div>
          </form>
	
</div>
<div class="clr"></div>

<script type="text/javascript">
function getMaterial(){
	
	var btn = $('#btn_material');
	btn.html('正在获取...');
	var select = $('#response');
	select.html('');
	var surl = '{cms>:U('Messager/getMaterial')}';
	$.ajax({
		dataType:'json',
		type:"POST",
		url:surl,
		cache: false,
        contentType: false,
        processData: false,
        success: function(data) {
        	btn.html('获取素材');
        	if(data == '0'){
        		alert('通信错误，请稍后再试');
        		return;
        	}
        	for(var i = 0; i<data.length;i++){
        		var d = data[i];
        		var op = $('<option value="'+d.id +'">'+ d.title+'</option>');
        		select.append(op);
        	}
        }
	});
	
	
}

</script>


<include file="Public:footer"/>